package com.kayt.cyberBar.common.utils;

import org.apache.cxf.message.Message;
import org.apache.cxf.phase.PhaseInterceptorChain;
import org.apache.cxf.transport.http.AbstractHTTPDestination;

import javax.servlet.http.HttpServletRequest;

/**
 * Description
 *
 * @author Kevin
 * @since 12/27/2017 22:59
 */
public class NetUtils {
    public static String getIP(){
        return getRequest().getRemoteAddr();
    }
    public static HttpServletRequest getRequest(){
        Message message = PhaseInterceptorChain.getCurrentMessage();
        HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST);
        return request;
    }
}
